{include file="public/header"}
<style>
	.uinfo{margin: 1vw !important;border:1px solid lightgrey;position:relative;overflow: hidden}
	.active2{border:1px solid green;}
	.label{background:green;position:absolute;right:0;top:0;z-Index:2;padding:1em;transform-origin:left bottom;transform:translate(29.29%,-100%) rotate(45deg);}
</style>
</head>
<body>
<header>
	<div>
		<a href="javascript:history.back();"><i class="icon-fanhui icon iconfont"></i></a>
	</div>
	<div>
		确认订单
	</div>
	<div></div>
</header>
<div class="main vip">
	<div class="tabContent">
		<div class="orderDetail">
			<form id="tobuy" action="{:url('Good/userAdd',input('get.'))}" method="post">
				<div class="take">
					<h1>收货信息</h1>
					{foreach $list as $v}
					<span class="uinfo {if $v['is_default']==1}active2{/if}" aid="{$v['id']}">
						<span class="name">{$v['name']}</span>
						<span class="pnumber">{$v['tel']}</span> <br>
                        <span class="adr">{$v['asheng']} {$v['acity']} {$v['aquyu']} {$v['address']}</span>
						<div class="label" {if $v['is_default']!==1}style="display:none"{/if} ></div>
				</span>
				{if $v['is_default']==1}
				<input type="hidden" name="" id="aid" value="{$v['id']}">
				{/if}
				{/foreach}
				<script>
                    $(function () {
                        var id = $('#aid').val();
                        $('.dizhi').val(id);
                    })
                    $('.uinfo').click(function () {
                        var aid=$(this).attr("aid");
                        $('.dizhi').val(aid);//选中谁就传谁得id
                        //改变样式
                        $(".uinfo").removeClass("active2");//removeClass删除一个class名字
                        $(this).addClass("active2");//addClass添加一个class名字
                        $(".label").hide();//将所有的都隐藏
                        $(this).children("div").show();
                    })
				</script>
				<span>
                        <a href="{:url('Address/addressAdd')}">请添加收货地址</a>
                    </span>
				<input type="hidden" name="aid" class="dizhi" value="">
		</div>


		<div class="pay">
			<h1>支付信息</h1>
			<span class="tprice">
						总金额：<span>¥{$line['amount']}</span>
						<input type="hidden" name="amount" value="{$line['amount']}">
					</span>
		</div>
		<div class="goods">
			<h1>商品清单</h1>
			<div class="item">
				<div class="img">
					<img src="/static/{$line['photo']}" alt="">
				</div>
				<div class="ginfo">
							<span class="gname">
								{$line['name']}
								<input type="hidden" name="gname[]" value="{$line['name']}">
							</span>
					<span class="gprice">
								￥ {$line['price']} X {$line['num']} = {$line['price']*$line['num']}
								<input type="hidden" name="pid[]" value="{$line['pid']}">
								<input type="hidden" name="price[]" value="{$line['price']}">
								<input type="hidden" name="num[]" value="{$line['num']}">
							</span>
				</div>
			</div>
		</div>
	</div>
	<button href="javascript:subb();" class="btn" style="color: white !important;" >确认订单</button>
</div>
</form>

</div>
</div>
</body>
</html>